This notebook contains the second attempt to generate the training data, by which I mean the black and white plots containing, just the contourlines, the ticks of the axes, and axes labels. For the base plot we use the code from experiment 02a_plotly.ipynb. To generate the sides of the triangle we use the Scatterternary code from experiment 02b_plotly.ipynb. We combine the base plot and the sides of the triangle to generate the final plot.
from plotly.figure_factory._ternary_contour import create_ternary_contour
import numpy as np
Al = np.array([0.0, 0.0, 0.0, 0.0, 1.0 / 3, 1.0 / 3, 1.0 / 3, 2.0 / 3, 2.0 / 3, 1.0])
Cu = np.array([0.0, 1.0 / 3, 2.0 / 3, 1.0, 0.0, 1.0 / 3, 2.0 / 3, 0.0, 1.0 / 3, 0.0])
Y = 1 - Al - Cu
# synthetic data for mixing enthalpy
# See https://pycalphad.org/docs/latest/examples/TernaryExamples.html
enthalpy = (Al - 0.01) * Cu * (Al - 0.52) * (Cu - 0.48) * (Y - 1) ** 2
fig = create_ternary_contour(
np.array([Al, Y, Cu]),
enthalpy,
pole_labels=["Al", "Y", "Cu"],
interp_mode="cartesian",
coloring="lines",
linecolor="black",
width=700,
height=700
)
fig.update_ternaries(aaxis_showgrid=False)
fig.update_ternaries(baxis_showgrid=False)
fig.update_ternaries(caxis_showgrid=False)
fig.update_ternaries(bgcolor="rgba(0,0,0,0)")
fig.show()
The width of the side lines is set to 12. This is the minimum width that is visible in the plot.
import plotly.graph_objects as go
fig.add_trace(go.Scatterternary(
a=[1, 0, 0, 1],
b=[0, 1, 0, 0],
c=[0, 0, 1, 0],
mode="lines",
line=dict(color='black', width=12),
fill='toself',
fillcolor="rgba(0,0,0,0)",
name="border",
))
The width of the side lines is set to 20. This is way too thick.
fig = create_ternary_contour(
np.array([Al, Y, Cu]),
enthalpy,
# pole_labels=["Al", "Y", "Cu"],
interp_mode="cartesian",
coloring="lines",
linecolor="black",
width=700,
height=700
)
fig.update_ternaries(aaxis_showgrid=False)
fig.update_ternaries(baxis_showgrid=False)
fig.update_ternaries(caxis_showgrid=False)
fig.update_ternaries(bgcolor="rgba(0,0,0,0)")
fig.add_trace(go.Scatterternary(
a=[1, 0, 0, 1],
b=[0, 1, 0, 0],
c=[0, 0, 1, 0],
mode="lines",
line=dict(color='black', width=20),
fill='toself',
fillcolor="rgba(0,0,0,0)",
name="border",
))
We have successfully generated combined the base plot and the sides of the triangle to generate the final plot. The line width of the sides of the triangle must be set to a value greater than 11, otherwise the sides of the triangle will not be visible. But the line width must not be set to a value much greater than 11, otherwise the sides of the triangle will be too thick. The ideal value for the line width of the sides of the triangle is still to be determined. We will consider this in future experiments.